<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>实现网格吸附</title>
    <style>
        /* *::-webkit-scrollbar {
	            display: none;
        } */
        body{
            user-select: none;  /*控制无法选中文字*/
            background-color: white;
            background-image: url("./icon/backgroundImage.png");
            background-size: cover;
            background-attachment: fixed;/*控制背景图片不动*/
            overflow-x: auto; 
            overflow-y: auto; 
        }

        #divContainer{
            position: relative;
            min-width: 1200px;
            width: 100%;
            height: 97vh;
        }

        .myDiv{
            width: 150px;
            height: 150px;
            margin: 0px;
            position: absolute;
            border-radius: 5%;
            cursor: grab;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center
        }

        .divIcon{
            border-radius: 12%;
            margin: 8%;
            width: 60%;
            max-width: 60%;
            height: 60%;
            max-height: 60%;
            background-repeat: no-repeat;
            background-size: cover;
            transition: transform 0.3s ease-out;
            /* 实现字体填充 */
            font-size: 60px;
            text-align: center;
        }

        .divIcon:hover{
            transform: translateY(-5px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }

        .divIconName{
            width: 110px;
            height: 20px;
            line-height: 20px;
            font-size: 20px;
            color: white;
            text-align: center;
            font-weight: bold;
        }

        #divMoveDisplay{
            position: absolute;
            border-radius: 5%;
            opacity: 0.3;
            display: none; /* 初始状态隐藏 */
            transition: left 0.1s ease-in, top 0.1s ease-in; /*设置过渡效果*/
        }

        .myDiv-big{
            width: 200px;
            height: 200px;
            margin: 0px;
            border-radius: 5%;
            background: #e0e0e0;
            position: absolute;
            cursor: grab;
        }

        .myDiv-big:hover{
            transform: translateY(-5px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }

        .moverMenu{
            position: absolute;
            width: 100px;
            height: 0px;
            background-color: gray;
            opacity: 0; /* 初始透明度为 0 */
            transition: all 0.3s ease-in;
        }

        .moverMenu.visible {
            width: 250px;
            height: 350px;
            opacity: 1; /* 最终透明度为 1 */
        }
    </style>
    

    <script src="./DivMover.js"></script>
    <script src="./DivContainer.js"></script>
    <script src="./FolderMover.js"></script>
    <script src="./Util.js"></script>
</head>
<body>
    <div id="divContainer">
        <div id="divMoveDisplay"></div>
    </div>
    
    <script>
        let x
        let y
        let gridSize =150
        document.addEventListener("DOMContentLoaded",()=>{
            y =new DivContainer(document.getElementById("divContainer"),gridSize)
            y.setDivByJson()
        })
    </script>
</body>
</html>